﻿Public Class FrmWheather

    Private m_SpeedWind As WindSpeed = New WindSpeed
    Private index As Integer = 0
    Private m_Cricles As New Rose.Pannel '画风玫瑰图线
    ''' <summary>
    ''' WindSpeed 风的一些数据及属性 可用来作数据表、风玫瑰图等
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property SpeedWind() As WindSpeed
        Get
            Return m_SpeedWind
        End Get
        Set(ByVal value As WindSpeed)
            m_SpeedWind = value
        End Set
    End Property
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        m_SpeedWind = New WindSpeed
        Me.m_SpeedWind.Buttonx()
        RadioButton1_CheckedChanged(sender, e)
        ShowAll(sender, e)
    End Sub

    Private Sub ShowAll(ByVal sender As System.Object, ByVal e As System.EventArgs)
        ShowData()
        Button3_Click(sender, e)
        showTemp()
        ShowWindSpeedData()

        ShowSeasonWindSpeed()
        ShowSeasonLineChart()

        ReDim m_Cricles.Circles.ArrayCircles(16)
        For i As Integer = 0 To m_Cricles.Circles.ArrayCircles.Length - 1
            m_Cricles.Circles.ArrayCircles(i) = New Rose.Circle

            m_Cricles.Circles.ArrayCircles(i).CircleAxesTitle.Visible = False '标注是否可见
            m_Cricles.Circles.ArrayCircles(i).CircleAxes.Visible = False '圆圈线是否可见
            m_Cricles.Circles.ArrayCircles(i).CircleLable.Visible = False '刻度是否可见
        Next
        RoseControl1.CheckData = True
        UpdateRose_Click(sender, e)

    End Sub
    ''' <summary>
    ''' 某种方案的玫瑰图
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub DrawRoseDate()
        '是按度数显示/方位
        ''以下几记录为风玫瑰数组
        ReDim m_Cricles.Circles.ArryDegreeSpeed(16)
        For i As Integer = 0 To 16
            ReDim m_Cricles.Circles.ArryDegreeSpeed(i)(36)
            For j As Integer = 0 To 36
                m_Cricles.Circles.ArryDegreeSpeed(i)(j) = m_SpeedWind.ArryWindDegree(i, j)
            Next
        Next
        ReDim m_Cricles.Circles.ArryAzimuthSpeed(16)
        For i As Integer = 0 To 16
            ReDim m_Cricles.Circles.ArryAzimuthSpeed(i)(16)
            For j As Integer = 0 To 16
                m_Cricles.Circles.ArryAzimuthSpeed(i)(j) = m_SpeedWind.ArryWindBearing(i, j)

            Next
        Next
        ReDim m_Cricles.Circles.ArryDegreeFrequency(16)
        For i As Integer = 0 To 16
            ReDim m_Cricles.Circles.ArryDegreeFrequency(i)(36)
            For j As Integer = 0 To 36
                m_Cricles.Circles.ArryDegreeFrequency(i)(j) = m_SpeedWind.ArryWindFreDegree(i, j)
            Next
        Next
        ReDim m_Cricles.Circles.ArryAzimuthFrequency(16)
        For i As Integer = 0 To 16
            ReDim m_Cricles.Circles.ArryAzimuthFrequency(i)(16)
            For j As Integer = 0 To 16
                m_Cricles.Circles.ArryAzimuthFrequency(i)(j) = m_SpeedWind.ArryWindFrequency(i, j)
            Next
        Next

        RosePaintForm2.RosePaintSetting.ContourPannel.Circles = m_Cricles.Circles
        Me.Refresh()
    End Sub

   

    ''' <summary>
    ''' 显示数据
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ShowData()
       
        '温度
        Me.EFlex5.Clear()
        Me.m_SpeedWind.TemperatureStat()
        Me.EFlex5.SetData(0, 0, "月份")
        Me.EFlex5.SetData(1, 0, "温度(°C)")
        Me.EFlex5.SetData(0, 13, "全年")
        For i As Integer = 0 To 11
            Me.EFlex5.SetData(0, i + 1, (i + 1).ToString & "月")
            Me.EFlex5.SetData(1, i + 1, Me.m_SpeedWind.ArryTemperature(i))
        Next
        Me.EFlex5.SetData(1, 13, Me.m_SpeedWind.ArryTemperature(12))
        EFlex5.AutoSizeCols()
        EFlex5.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        EFlex5.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Columns
    End Sub

    ''' <summary>
    ''' 按度数求风频
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub DegreeToWindfrequency()
        '按度数求风频--------------
        Me.EFlexDirection.Cols.Count = 38
        Me.EFlexDirection.Rows.Count = 18
        Me.EFlexDirection.Clear()
        Me.m_SpeedWind.WindFrequency(36)
        For i As Integer = 0 To 16
            For j As Integer = 0 To 36
                Me.EFlexDirection.SetData(i + 1, j + 1, String.Format(Me.m_SpeedWind.ArryWindFreDegree(i, j), "#.0000"))
            Next
        Next
        '设置表行标题
        For i As Integer = 1 To 36
            Me.EFlexDirection.SetData(0, i, (i * 10).ToString() + "°")
        Next
        Me.EFlexDirection.SetData(0, 37, "静风")
        '设置表列标题
        Me.EFlexDirection.SetData(0, 0, "月份")
        For i As Integer = 1 To 12
            Me.EFlexDirection.SetData(i, 0, i.ToString() + "月")
        Next
        Me.EFlexDirection.SetData(13, 0, "全年")
        EFlexDirection.AutoSizeCols()
        Me.EFlexDirection.SetData(14, 0, "春季")
        Me.EFlexDirection.SetData(15, 0, "夏季")
        Me.EFlexDirection.SetData(16, 0, "秋季")
        Me.EFlexDirection.SetData(17, 0, "冬季")
        Me.EFlexDirection.AutoSizeCols()
        EFlexDirection.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        EFlexDirection.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Columns
    End Sub

    ''' <summary>
    ''' 按方向求风频
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub DirectionToWindfrequency()
        '按方向求风频------------------------------------------
        '设置列标题
        Me.EFlexDirection.Clear()
        Me.EFlexDirection.Rows.Count = 18
        Me.EFlexDirection.Cols.Count = 18
        Me.m_SpeedWind.WindFrequency(16)
        For i As Integer = 0 To 16
            For j As Integer = 0 To 16
                Me.EFlexDirection.SetData(i + 1, j + 1, String.Format(Me.m_SpeedWind.ArryWindFrequency(i, j), "#.0000"))
            Next
        Next
        Me.EFlexDirection.SetData(0, 0, "月份")
        For i As Integer = 1 To 12
            Me.EFlexDirection.SetData(i, 0, i.ToString() + "月")
        Next
        Me.EFlexDirection.SetData(0, 1, "N")
        Me.EFlexDirection.SetData(0, 2, "NNE")
        Me.EFlexDirection.SetData(0, 3, "NE")
        Me.EFlexDirection.SetData(0, 4, "ENE")
        Me.EFlexDirection.SetData(0, 5, "E")
        Me.EFlexDirection.SetData(0, 6, "ESE")
        Me.EFlexDirection.SetData(0, 7, "SE")
        Me.EFlexDirection.SetData(0, 8, "SSE")
        Me.EFlexDirection.SetData(0, 9, "S")
        Me.EFlexDirection.SetData(0, 10, "SSW")
        Me.EFlexDirection.SetData(0, 11, "SW")
        Me.EFlexDirection.SetData(0, 12, "WSW")
        Me.EFlexDirection.SetData(0, 13, "W")
        Me.EFlexDirection.SetData(0, 14, "WNW")
        Me.EFlexDirection.SetData(0, 15, "NW")
        Me.EFlexDirection.SetData(0, 16, "NNW")
        Me.EFlexDirection.SetData(0, 17, "静风")
        EFlexDirection.AutoSizeCols()
        Me.EFlexDirection.SetData(13, 0, "全年")
        Me.EFlexDirection.SetData(14, 0, "春季")
        Me.EFlexDirection.SetData(15, 0, "夏季")
        Me.EFlexDirection.SetData(16, 0, "秋季")
        Me.EFlexDirection.SetData(17, 0, "冬季")
        EFlexDirection.AutoSizeCols()
        EFlexDirection.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        EFlexDirection.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Columns
    End Sub

    ''' <summary>
    ''' 按度数求风速
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub DegreeToWindspeed()
        '按度数求风速---------------------------------------------------
        Me.EFlexDegree.Clear()
        Me.EFlexDegree.Rows.Count = 18
        Me.EFlexDegree.Cols.Count = 38
        Me.m_SpeedWind.WindBearing(36)
        For i As Integer = 0 To 16
            For j As Integer = 0 To 36
                Me.EFlexDegree.SetData(i + 1, j + 1, String.Format(Me.m_SpeedWind.ArryWindDegree(i, j), "#.0000"))
            Next
        Next
        '设置表行标题
        For i As Integer = 1 To 36
            Me.EFlexDegree.SetData(0, i, (i * 10).ToString() + "°")
        Next
        Me.EFlexDegree.SetData(0, 37, "平均")
        '设置表列标题
        Me.EFlexDegree.SetData(0, 0, "月份")
        For i As Integer = 1 To 12
            Me.EFlexDegree.SetData(i, 0, i.ToString() + "月")
        Next
        Me.EFlexDegree.SetData(13, 0, "全年")
        EFlexDegree.AutoSizeCols()
        Me.EFlexDegree.SetData(14, 0, "春季")
        Me.EFlexDegree.SetData(15, 0, "夏季")
        Me.EFlexDegree.SetData(16, 0, "秋季")
        Me.EFlexDegree.SetData(17, 0, "冬季")
        EFlexDegree.AutoSizeCols()
        EFlexDegree.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        EFlexDegree.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Columns
    End Sub

    ''' <summary>
    ''' 按方向求风速
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub DirectionToWindspeed()
        '按方向求风速------------
        '设置列标题
        Me.EFlexDegree.Clear()
        Me.EFlexDegree.Cols.Count = 18
        Me.EFlexDegree.Rows.Count = 18
        Me.m_SpeedWind.WindBearing(16)
        For i As Integer = 0 To 16
            For j As Integer = 0 To 16
                Me.EFlexDegree.SetData(i + 1, j + 1, String.Format(Me.m_SpeedWind.ArryWindBearing(i, j), "#.0000"))
            Next
        Next
        Me.EFlexDegree.SetData(0, 0, "月份")
        For i As Integer = 1 To 12
            Me.EFlexDegree.SetData(i, 0, i.ToString() + "月")
        Next
        Me.EFlexDegree.SetData(0, 1, "N")
        Me.EFlexDegree.SetData(0, 2, "NNE")
        Me.EFlexDegree.SetData(0, 3, "NE")
        Me.EFlexDegree.SetData(0, 4, "ENE")
        Me.EFlexDegree.SetData(0, 5, "E")
        Me.EFlexDegree.SetData(0, 6, "ESE")
        Me.EFlexDegree.SetData(0, 7, "SE")
        Me.EFlexDegree.SetData(0, 8, "SSE")
        Me.EFlexDegree.SetData(0, 9, "S")
        Me.EFlexDegree.SetData(0, 10, "SSW")
        Me.EFlexDegree.SetData(0, 11, "SW")
        Me.EFlexDegree.SetData(0, 12, "WSW")
        Me.EFlexDegree.SetData(0, 13, "W")
        Me.EFlexDegree.SetData(0, 14, "WNW")
        Me.EFlexDegree.SetData(0, 15, "NW")
        Me.EFlexDegree.SetData(0, 16, "NNW")
        Me.EFlexDegree.SetData(0, 17, "平均")

        Me.EFlexDegree.SetData(13, 0, "全年")
        Me.EFlexDegree.SetData(14, 0, "春季")
        Me.EFlexDegree.SetData(15, 0, "夏季")
        Me.EFlexDegree.SetData(16, 0, "秋季")
        Me.EFlexDegree.SetData(17, 0, "冬季")
        EFlexDegree.AutoSizeCols()
        EFlexDegree.AutoSizeCols()
        EFlexDegree.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        EFlexDegree.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Columns
    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged
        If RadioButton1.Checked Then
            'UltraTabPageControl1.Tab.Visible = True
            'UltraTabPageControl2.Tab.Visible = True
            'UltraTabPageControl3.Tab.Visible = False
            'UltraTabPageControl4.Tab.Visible = False
            DegreeToWindfrequency()
            DegreeToWindspeed()

            m_Cricles.Circles.RoseLengCheck.ModeCheck = True
        Else
            'UltraTabPageControl1.Tab.Visible = False
            'UltraTabPageControl2.Tab.Visible = False
            'UltraTabPageControl3.Tab.Visible = True
            'UltraTabPageControl4.Tab.Visible = True
            DirectionToWindfrequency()
            DirectionToWindspeed()

            m_Cricles.Circles.RoseLengCheck.ModeCheck = False
        End If
        UpdateRose_Click(sender, e)
        Button3_Click(sender, e)
    End Sub

    Private Sub EFlexDirection_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles EFlexDirection.Validating
        Try
            If RadioButton1.Checked = True Then
                '为风频数组赋值,按度数10--360
                For i As Integer = 0 To 16
                    For j As Integer = 0 To 36
                        Me.m_SpeedWind.ArryWindFreDegree(i, j) = Me.EFlexDirection.GetData(i + 1, j + 1)
                    Next
                Next
            Else
                '为风频数组赋值,按方位 16 个方位
                For i As Integer = 0 To 16
                    For j As Integer = 0 To 16
                        Me.m_SpeedWind.ArryWindFrequency(i, j) = Me.EFlexDirection.GetData(i + 1, j + 1)
                    Next
                Next
            End If
        Catch ex As Exception

        End Try
    End Sub

    Private Sub EFlexDegree_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles EFlexDegree.Validating
        Try
            If RadioButton1.Checked = True Then
                '为风速数组赋值,按度数10--360
                For i As Integer = 0 To 16
                    For j As Integer = 0 To 36
                        Me.m_SpeedWind.ArryWindDegree(i, j) = Me.EFlexDegree.GetData(i + 1, j + 1)
                    Next
                Next
            Else
                '为风速数组赋值,按方位 16 个方位
                For i As Integer = 0 To 16
                    For j As Integer = 0 To 16
                        Me.m_SpeedWind.ArryWindBearing(i, j) = Me.EFlexDirection.GetData(i + 1, j + 1)
                    Next
                Next
            End If
        Catch ex As Exception

        End Try
    End Sub

    '为温度数组赋值,按月份12个月
    Private Sub EFlex5_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles EFlex5.Validating
        For i As Integer = 0 To 12
            Me.m_SpeedWind.ArryTemperature(i) = Me.EFlex5.GetData(1, i + 1)
        Next
    End Sub

    Private Sub FrmWheather_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        '转换为中文
        Steema.TeeChart.Languages.ChineseSimp.Activate()


        Me.EFlex5.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.EFlexDegree.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.EFlexDirection.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.EFlexSeason.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)
        Me.EFlexWindSpeed.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)

        CheckedListBox1.SetItemChecked(1, True)
        Me.CheckedListBox1.SetItemChecked(2, True)

        Me.CheckedListRose.SetItemChecked(1, True)
        Me.CheckedListRose.SetItemChecked(4, True)
        Me.CheckedListRose.SetItemChecked(7, True)
        Me.CheckedListRose.SetItemChecked(10, True)
        Me.CheckedListRose.SetItemChecked(13, True)
        'Me.CheckedListRose.SetItemChecked(0, True)

        Me.TChart1.Aspect.View3D = False
        Me.TChartSeasion.Aspect.View3D = False
        Me.TCWindSpeed.Aspect.View3D = False

        ToolStripComboBox1.SelectedIndex = 0
        Me.EFlexDirection.Clear()
        If Me.m_SpeedWind.metd.ArrayMetData.Length > 0 Then
            RadioButton1_CheckedChanged(sender, e)
            ShowAll(sender, e)
        End If


        Me.EFlex5.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlex5.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlex5.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None

        Me.EFlexDegree.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexDegree.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexDegree.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None

        Me.EFlexDirection.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexDirection.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexDirection.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None

        Me.EFlexSeason.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexSeason.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexSeason.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None

        Me.EFlexWindSpeed.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexWindSpeed.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexWindSpeed.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TChart1.Panel.Gradient.Visible = True
        TChart1.Panel.Gradient.StartColor = Color.White      ' 图表底色开始颜色
        TChart1.Panel.Gradient.EndColor = Color.White     ' 图表底色结束颜色
        TChart1.Header.Font.Color = Color.Black
        '是否是3D效果
        Me.TChart1.Aspect.View3D = False
        Me.TChart1.Header.Text = "月平均风速变化图"
        Dim Pub(-1, -1) As Double
        If Me.RadioButton1.Checked Then
            Pub = Me.m_SpeedWind.ArryWindDegree
        End If
        If Me.RadioButton1.Checked Then
            TChart1.Series.Clear()
            Dim mSelectIndex As Integer = 0
            For i As Integer = 0 To CheckedListBox1.CheckedIndices.Count - 1
                mSelectIndex = CheckedListBox1.CheckedIndices(i)

                If mSelectIndex = 0 Then '全部的数据
                    For p As Integer = 0 To 11
                        Dim Ser1 As New Steema.TeeChart.Styles.Line
                        For j As Integer = 0 To 36
                            Ser1.Add(j, Pub(p, j))
                        Next
                        Ser1.Title = (p + 1).ToString() & "月"
                        TChart1.Series.Add(Ser1)
                    Next
                    Dim Ser2 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 36
                        Ser2.Add(j, Pub(12, j))
                    Next
                    Ser2.Title = "全年"
                    TChart1.Series.Add(Ser2)
                    Dim Ser3 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 36
                        Ser3.Add(j, Pub(13, j))
                    Next
                    Ser3.Title = "春季"
                    TChart1.Series.Add(Ser3)
                    Dim Ser4 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 36
                        Ser4.Add(j, Pub(14, j))
                    Next
                    Ser4.Title = "夏季"
                    TChart1.Series.Add(Ser4)
                    Dim Ser5 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 36
                        Ser5.Add(j, Pub(15, j))
                    Next
                    Ser5.Title = "秋季"
                    TChart1.Series.Add(Ser5)
                    Dim Ser6 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 36
                        Ser6.Add(j, Pub(15, j))
                    Next
                    Ser6.Title = "冬季"
                    TChart1.Series.Add(Ser6)
                    Exit For
                Else
                    '处理的选中的数据
                    Dim Ser As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 36
                        Ser.Add(j, Pub(mSelectIndex - 1, j))
                    Next
                    If mSelectIndex = 1 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 2 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 3 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 4 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 5 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 6 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 7 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 8 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 9 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 10 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 11 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 12 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 13 Then
                        Ser.Title = "全年"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 14 Then
                        Ser.Title = "春季"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 15 Then
                        Ser.Title = "夏季"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 16 Then
                        Ser.Title = "秋季"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 17 Then
                        Ser.Title = "冬季"
                        TChart1.Series.Add(Ser)
                    End If
                End If
            Next
            Me.TChart1.Axes.Bottom.Automatic = False
            Me.TChart1.Axes.Bottom.Minimum = 0
            Me.TChart1.Axes.Bottom.Maximum = 36
        End If
        If Me.RadioButton2.Checked Then
            TChart1.Series.Clear()
            '按方位的曲线图'''''''''''''''''''''''''''''
            Dim PubF(-1, -1) As Double
            'If Me.RadioButton3.Checked And Me.RadioButton2.Checked Then
            '    PubF = Me.m_SpeedWind.ArryWindFrequency
            'End If
            If Me.RadioButton2.Checked Then
                PubF = Me.m_SpeedWind.ArryWindBearing
            End If

            TChart1.Series.Clear()
            Dim mSelectIndex As Integer
            For i As Integer = 0 To CheckedListBox1.CheckedIndices.Count - 1
                mSelectIndex = CheckedListBox1.CheckedIndices(i)
                If mSelectIndex = 0 Then '全部的数据
                    For p As Integer = 0 To 11
                        Dim Ser1 As New Steema.TeeChart.Styles.Line
                        For j As Integer = 0 To 16
                            Ser1.Add(j, PubF(p, j))
                        Next
                        Ser1.Title = (p + 1).ToString() & "月"
                        TChart1.Series.Add(Ser1)
                    Next
                    Dim Ser2 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 16
                        Ser2.Add(j, PubF(12, j))
                    Next
                    Ser2.Title = "全年"
                    TChart1.Series.Add(Ser2)
                    Dim Ser3 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 16
                        Ser3.Add(j, PubF(13, j))
                    Next
                    Ser3.Title = "春季"
                    TChart1.Series.Add(Ser3)
                    Dim Ser4 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 16
                        Ser4.Add(j, PubF(14, j))
                    Next
                    Ser4.Title = "夏季"
                    TChart1.Series.Add(Ser4)
                    Dim Ser5 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 16
                        Ser5.Add(j, PubF(15, j))
                    Next
                    Ser5.Title = "秋季"
                    TChart1.Series.Add(Ser5)
                    Dim Ser6 As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 16
                        Ser6.Add(j, PubF(15, j))
                    Next
                    Ser6.Title = "冬季"
                    TChart1.Series.Add(Ser6)
                    Exit For
                Else
                    '处理的选中的数据
                    Dim Ser As New Steema.TeeChart.Styles.Line
                    For j As Integer = 0 To 16
                        Ser.Add(j, PubF(mSelectIndex - 1, j))
                    Next
                    If mSelectIndex = 1 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 2 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 3 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 4 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 5 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 6 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 7 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 8 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 9 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 10 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 11 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 12 Then
                        Ser.Title = (mSelectIndex).ToString() & "月"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 13 Then
                        Ser.Title = "全年"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 14 Then
                        Ser.Title = "春季"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 15 Then
                        Ser.Title = "夏季"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 16 Then
                        Ser.Title = "秋季"
                        TChart1.Series.Add(Ser)
                    End If
                    If mSelectIndex = 17 Then
                        Ser.Title = "冬季"
                        TChart1.Series.Add(Ser)
                    End If
                End If
            Next
            Me.TChart1.Axes.Bottom.Automatic = False
            Me.TChart1.Axes.Bottom.Minimum = 0
            Me.TChart1.Axes.Bottom.Maximum = 16
        End If
        TChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
        TChart1.Legend.Shadow.Visible = False
    End Sub

    ''' <summary>
    ''' 年平均温度的月变化图
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub showTemp()
        Me.TChart4.Aspect.View3D = False
        Me.TChart4.Series.Clear()
        Dim ser As New Steema.TeeChart.Styles.Line
        For i As Integer = 0 To 11
            ser.Add(i + 1, Me.m_SpeedWind.ArryTemperature(i), (i + 1).ToString(), Color.Black)
        Next
        Me.TChart4.Series.Add(ser)
        Me.TChart4.Header.Text = "全年的温度变化曲线图"
        Me.TChart4.Header.Font.Color = Color.Black
        TChart4.Panel.Gradient.Visible = True
        TChart4.Panel.Gradient.StartColor = Color.White      ' 图表底色开始颜色
        TChart4.Panel.Gradient.EndColor = Color.White     ' 图表底色结束颜色
        '设置左坐标
        Me.TChart4.Axes.Left.Automatic = False
        Me.TChart4.Axes.Left.Minimum = -10
        Me.TChart4.Axes.Left.Maximum = 30
        Me.TChart4.Axes.Left.Increment = 5
        'Me.TChart4.Axes.Left.Ticks.Visible = False
        Me.TChart4.Axes.Left.TicksInner.Visible = True

        Me.TChart4.Axes.Left.TicksInner.Length = 4

        '设置底坐标
        Me.TChart4.Axes.Bottom.Automatic = False
        Me.TChart4.Axes.Bottom.Minimum = 1
        Me.TChart4.Axes.Bottom.Maximum = 12
        '设置折线样式
        ser.Pointer.Visible = True
        ser.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle
        ser.Pointer.HorizSize = 2
        ser.Pointer.VertSize = 2


    End Sub

    ''' <summary>
    ''' 年平均风速的月变化图
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ShowWindSpeedData()
        Me.EFlexWindSpeed.Clear()
        Me.m_SpeedWind.TemperatureStat()
        Me.EFlexWindSpeed.SetData(0, 0, "月份")
        Me.EFlexWindSpeed.SetData(1, 0, "风速/(m/s)")
        Me.EFlexWindSpeed.SetData(0, 13, "全年")
        For i As Integer = 0 To 11
            Me.EFlexWindSpeed.SetData(0, i + 1, (i + 1).ToString & "月")
            Me.EFlexWindSpeed.SetData(1, i + 1, Me.m_SpeedWind.ArryWindSpeed(i))
        Next
        Me.EFlexWindSpeed.SetData(1, 13, Me.m_SpeedWind.ArryWindSpeed(12))
        EFlexWindSpeed.AutoSizeCols()


        Me.TCWindSpeed.Aspect.View3D = False
        Me.TCWindSpeed.Series.Clear()
        Dim ser As New Steema.TeeChart.Styles.Line
        For i As Integer = 0 To 11
            ser.Add(i + 1, Me.m_SpeedWind.ArryWindSpeed(i), (i + 1).ToString(), Color.Black)
        Next
        Me.TCWindSpeed.Series.Add(ser)
        Me.TCWindSpeed.Header.Text = "年平均风速的月变化曲线图"
        Me.TCWindSpeed.Header.Font.Color = Color.Black
        TCWindSpeed.Panel.Gradient.Visible = True
        TCWindSpeed.Panel.Gradient.StartColor = Color.White      ' 图表底色开始颜色
        TCWindSpeed.Panel.Gradient.EndColor = Color.White     ' 图表底色结束颜色
        '设置左坐标
        Me.TCWindSpeed.Axes.Left.Automatic = False
        Me.TCWindSpeed.Axes.Left.Minimum = 0
        Me.TCWindSpeed.Axes.Left.Maximum = 5
        Me.TCWindSpeed.Axes.Left.Increment = 1
        '设置底坐标
        Me.TCWindSpeed.Axes.Bottom.Automatic = False
        Me.TCWindSpeed.Axes.Bottom.Minimum = 1
        Me.TCWindSpeed.Axes.Bottom.Maximum = 12


        '设置折线样式
        ser.Pointer.Visible = True
        ser.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle
        ser.Pointer.HorizSize = 2
        ser.Pointer.VertSize = 2
    End Sub

    Private Sub UpdateRose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateRose.Click
        For j As Integer = 0 To m_Cricles.Circles.RoseLengCheck.ArryShowData.Length - 1
            m_Cricles.Circles.RoseLengCheck.ArryShowData(j) = 0
        Next

        For i As Integer = 0 To CheckedListRose.CheckedIndices.Count - 1
            m_Cricles.Circles.RoseLengCheck.ArryShowData(i) = 0
            m_Cricles.Circles.RoseLengCheck.ArryShowData(i) = CheckedListRose.CheckedIndices(i) + 1
        Next
        DrawRoseDate()
        RoseControl1.SettingPannel = m_Cricles
    End Sub
    '鼠标
    Private Sub ToolStripButtonArrow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonArrow.Click
        RosePaintForm2.SetMouseType(0) '箭头形
    End Sub
    '手形
    Private Sub ToolStripButtonMove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonMove.Click
        '移动
        RosePaintForm2.SetMouseType(4)
    End Sub

    Private Sub ToolStripButtonZoomIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonZoomIn.Click
        '在绘图放大 
        RosePaintForm2.SetMouseType(2)
    End Sub

    Private Sub ToolStripButtonZoomOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonZoomOut.Click
        '缩小
        RosePaintForm2.SetMouseType(3)
    End Sub

    Private Sub AaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AaToolStripMenuItem.Click
        TChart1.Export.Image.JPEG.CopyToClipboard()
    End Sub

    Private Sub ToolStripComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripComboBox1.SelectedIndexChanged
        If ToolStripComboBox1.SelectedIndex = 0 Then
            m_Cricles.Circles.RoseLengCheck.SpeedFrequencyCheck = True
        Else
            m_Cricles.Circles.RoseLengCheck.SpeedFrequencyCheck = False
        End If
        If m_Cricles.Circles.ArrayCircles IsNot Nothing AndAlso m_Cricles.Circles.ArrayCircles.Length > 0 Then
            UpdateRose_Click(sender, e)
        End If
    End Sub

    Private Sub 复制ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 复制ToolStripMenuItem.Click
        Me.TCWindSpeed.Export.Image.JPEG.CopyToClipboard()
    End Sub

    Private Sub SetToolMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetToolMenuItem.Click
        TCWindSpeed.ShowEditor()
    End Sub

    Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem1.Click
        TChart1.ShowEditor()
    End Sub

    Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
        TChart4.ShowEditor()
    End Sub

    Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
        TChart4.Export.Image.JPEG.CopyToClipboard()
    End Sub

    ''' <summary>
    ''' 显示季小时平均风速的日变化的方法
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ShowSeasonWindSpeed()
        m_SpeedWind.WindSpeedHoursData()
        EFlexSeason.Rows.Count = 1
        For k As Integer = 0 To 23
            EFlexSeason.SetData(0, k + 1, k.ToString + "时")
        Next
        EFlexSeason.SetData(0, 0, "风速(m/s)")
        EFlexSeason.Rows.Count = 5
        For i As Integer = 0 To 3
            For j As Integer = 0 To 23
                If m_SpeedWind.ArryWindSpeedHours(i, j) = 0 Then
                    EFlexSeason.SetData(i + 1, j + 1, "")
                Else
                    EFlexSeason.SetData(i + 1, j + 1, m_SpeedWind.ArryWindSpeedHours(i, j))
                End If
            Next
        Next
        EFlexSeason.SetData(1, 0, "春季")
        EFlexSeason.SetData(2, 0, "夏季")
        EFlexSeason.SetData(3, 0, "秋季")
        EFlexSeason.SetData(4, 0, "冬季")
        EFlexSeason.AutoSizeRows()
        EFlexSeason.AutoSizeCols()

    End Sub
    ''' <summary>
    ''' 显示季小时平均风速的日变化的曲线图的方法
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ShowSeasonLineChart()
        Me.TChartSeasion.Aspect.View3D = False
        Me.TChartSeasion.Series.Clear()

        For i As Integer = 0 To 3
            Dim ser As New Steema.TeeChart.Styles.Line
            '设置折线样式
            If i = 0 Then
                ser.Pointer.Visible = True
                ser.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle
                ser.Pointer.HorizSize = 3
                ser.Pointer.VertSize = 3
                ser.Pointer.Pen.Visible = False
            End If
            If i = 1 Then
                ser.Pointer.Visible = True
                ser.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Diamond
                ser.Pointer.HorizSize = 4
                ser.Pointer.VertSize = 4
                ser.Pointer.Pen.Visible = False
            End If
            If i = 2 Then
                ser.Pointer.Visible = True
                ser.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle
                ser.Pointer.HorizSize = 3
                ser.Pointer.VertSize = 3
                ser.Pointer.Pen.Visible = False
            End If
            If i = 3 Then
                ser.Pointer.Visible = True
                ser.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Star
                ser.Pointer.HorizSize = 2
                ser.Pointer.VertSize = 2

            End If

       
            For j As Integer = 0 To 23
                If m_SpeedWind.ArryWindSpeedHours(i, j) <> 0 Then
                    ser.Add(j, m_SpeedWind.ArryWindSpeedHours(i, j))
                End If
            Next
            Select Case i
                Case 0
                    ser.Title = "春季"
                Case 1
                    ser.Title = "夏季"
                Case 2
                    ser.Title = "秋季"
                Case 3
                    ser.Title = "冬季"
            End Select
            Me.TChartSeasion.Series.Add(ser)
        Next
        Me.TChartSeasion.Header.Text = "季小时平均风速的日变化图"
        Me.TChartSeasion.Header.Font.Color = Color.Black
        TChartSeasion.Panel.Gradient.Visible = True
        TChartSeasion.Panel.Gradient.StartColor = Color.White      ' 图表底色开始颜色
        TChartSeasion.Panel.Gradient.EndColor = Color.White     ' 图表底色结束颜色
        '设置左坐标
        Me.TChartSeasion.Axes.Left.Automatic = False
        Me.TChartSeasion.Axes.Left.Minimum = 0
        Me.TChartSeasion.Axes.Left.Maximum = 6
        Me.TChartSeasion.Axes.Left.Increment = 1
        '设置底坐标
        Me.TChartSeasion.Axes.Bottom.Automatic = False
        Me.TChartSeasion.Axes.Bottom.Minimum = 0
        Me.TChartSeasion.Axes.Bottom.Maximum = 23
        '设置序列格式
        'Me.TChartSeasion.Series=

        TChartSeasion.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
        TChartSeasion.Legend.CheckBoxes = True
        TChartSeasion.Legend.Shadow.Visible = False
    
    End Sub

    Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
        TChartSeasion.ShowEditor()
    End Sub

    Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
        TChartSeasion.Export.Image.JPEG.CopyToClipboard()
    End Sub

    '年平均风速月变化赋值
    Private Sub EFlexWindSpeed_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles EFlexWindSpeed.Validating
        For i As Integer = 0 To Me.m_SpeedWind.ArryWindSpeed.Length - 1
            Me.m_SpeedWind.ArryWindSpeed(i) = Me.EFlexWindSpeed.GetData(1, i + 1)
        Next
    End Sub
    '季小时平均风速的日变化赋值
    Private Sub EFlexSeason_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles EFlexSeason.Validating
        For i As Integer = 0 To 3
            For j As Integer = 0 To 23
                If EFlexSeason.GetData(i + 1, j + 1) = "" Then
                    m_SpeedWind.ArryWindSpeedHours(i, j) = 0
                Else
                    m_SpeedWind.ArryWindSpeedHours(i, j) = EFlexSeason.GetData(i + 1, j + 1)
                End If
            Next
        Next
    End Sub
End Class